package threadDemo1.currentThread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-27
 * Time: 16:47
 */
class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println(this.getId() + " " + this.getName());
    }
}

public class ThreadDemo {
    public static void main1(String[] args) {
        Thread thread = new MyThread();
        thread.start();
    }

    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            Thread t1 = Thread.currentThread();
            System.out.println(t1.getId()+ " " + t1.getName());
        });
        //
        thread.start();
    }
}
